package com.yao.sdk.ui;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.yao.sdk.core.YaoSDK;
import com.yao.sdk.net.NetConfig;
import com.yao.sdk.net.NetWork;
import com.yao.sdk.net.NetWorkListener;
import com.yao.sdk.net.ResponseInfo;

import java.util.Map;

/**
 * Created by Administrator on 2015/12/3.
 */
public class UIFragmentActivity extends FragmentActivity implements NetWorkListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (YaoSDK.getApplication() == null) {
            YaoSDK.init(this.getApplication());
        }
    }

    @Override
    public void onResponse( ResponseInfo responseInfo) {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    public void showDialog() {
        UIDialog.getInstance().showDialog(this, null, null);
    }


    public void showDialog(String message){
        UIDialog.getInstance().showDialog(this, null, message);
    }

    public void cancelDialog() {
        UIDialog.getInstance().cancelDialog();
    }


//    // 网络请求
//    public void request(String url, Map<String, String> params) {
//        NetWork.request(this, url, params);
//    }

    public void request(String url, Map<String, String> params, Map<String, String> header,String token) {
        NetWork.request(this, url, params, header,token);
    }

    public void request(String url, NetConfig.RequestMethod requestMethod, Map<String, String> params, Map<String, String> header,String token) {
        NetWork.request(this, url, requestMethod, params, header,token);
    }

}
